@include('admin._include.header')

<body>
<div class="layui-fluid">
    <div class="layui-row larryms-panel auth-user-add">
        <form class="layui-form layui-form-pane" method="post">

            <div class="layui-form-item">
                <label class="layui-form-label">快递单号</label>

                <div class="layui-input-inline" style="width: 350px">
                    <input type="text" name="express_sn" lay-verify="required" placeholder="请输入快递单号"  value="{{$order_express->express_sn}}"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">快递公司</label>

                <div class="layui-input-inline" style="width: 350px">
                    <select name="express_id" class="layui-select" lay-verify="required" id="">
                        <option value="">请选择快递公司</option>
                        @foreach($express as $item)
                            <option value="{{$item->id}}">{{$item->name}}</option>
                        @endforeach
                    </select>
                </div>
            </div>

            <div class="layui-form-item" style="text-align: center">
                <input type="hidden" name="id" value="{{$id}}">
                <button class="layui-btn" style="width: 200px" lay-submit lay-filter="submit">确定</button>
            </div>

        </form>
    </div>
</div>

<script>
    layui.config({
        base: "/plugin/layuiadmin/" //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'upload', 'form'], function () {
        var $ = layui.jquery;
        form = layui.form;

        form.on('submit(submit)', function(data) {
            var index = layer.load(1);
            $.ajax({
                url:"{{url('order/deliver')}}",
                dateType:'json',
                data:data.field,
                type:'post',
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                success:function (res) {
                    layer.close(index);
                    layer.msg(res.message);
                    if(res.status == SUCCESS){
                        var iframe = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(iframe); //再执行关闭
                    }
                }
            });

            return false;
        });

    });
</script>

</body>
@include('admin._include.footer')